package com.lch.base.http.exception;

/**
 * 错误码解析表
 *
 * @author lee(29487113@qq.com) on 17/11/1
 */
public class HttpCode {

    public class HttpState {
        public static final int SC_OK = 200;
        public static final int API_SUCCESS_CODE = 200; //跟服务器定义的成功标志
    }

    public class ServerError {
        public static final int ERROR_TRANSFORM = 0x1;  //解析错误
        public static final int UNKOWN_HOST = 0x2;      //服务器地址未找到,请检查网络或Url

        public static final int NET_ERROR = 0x3;         //网络错误
        public static final int SOCKET_TIMEOUT = 0x4;   //连接网络超时
        public static final int MAIN_HTREAD = 0x5;      //网络请求不能在主线程处理
        public static final int RETURE_DATA_NULL = 0x6; //返回的数据结构data 为空 或者解析不了
        public static final int SSL_ERROR = 0x7;        //证书验证失败
        public static final int SSL_NOT_FOUND = 0x8;    //书路径没找到
        public static final int CLASS_CAST = 0x9;       //类型转换出错
        public static final int NULL = 0x10;            //数据有空
        public static final int FORMAT_FAIL = 0x11;     //FormatException
        public static final int UNKNOWN = 0x12;         //未知错误
    }

    public class HttpError {
        public static final int ERROR_HTTP_400 = 400; //服务器不理解请求的语法 Bad Request
        public static final int ERROR_HTTP_401 = 401; //请求要求身份验证, （未授权的请求） Unauthorized
        public static final int ERROR_HTTP_403 = 403; //服务器拒绝请求（禁止访问）
        public static final int ERROR_HTTP_404 = 404; //服务器找不到请求的网页 （服务器地址未找到）Not Found
        public static final int ERROR_HTTP_408 = 408; //请求超时 Request Timeout
        public static final int ERROR_HTTP_417 = 417; //接口处理失败 Expectation Failed
        public static final int ERROR_HTTP_500 = 500; //服务器遇到错误，无法完成请求 （服务器出错）Internal Server Error
        public static final int ERROR_HTTP_502 = 502; //服务器作为网关或代理，从上游服务器收到无效响应。 （无效的请求）Bad Gateway
        public static final int ERROR_HTTP_503 = 503; //服务器目前无法使用（由于超载或停机维护） （服务器不可用）Service Unavailable
        public static final int ERROR_HTTP_504 = 504; //服务器作为网关或代理，但是没有及时从上游服务器收到请求 （网关响应超时）Gateway Timeout
    }

    /**
     * 接口错误
     */
    public class ApiError {
        public static final int API_TOKEN_UNAUTH = 10001; //token无效
    }
}
